.ai-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 50px); /* 减去底部导航栏的高度 */
  background-color: #ffffff;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* 顶部导航样式 */
.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #7c4dff 0%, #7e57ff 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.back-button, .header-right {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.back-button:active, .header-right:active {
  background-color: rgba(255, 255, 255, 0.2);
}

/* 聊天区域样式 */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 80px; /* 为底部输入框留出空间 */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  background-color: #f8f9fa;
}

.message-wrapper {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-content {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  position: relative;
  line-height: 1.5;
  font-size: 15px;
  word-break: break-word;
}

.user .message-content {
  background-color: #7c4dff;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 4px rgba(124, 77, 255, 0.2);
}

.ai .message-content {
  background-color: white;
  color: #2c3e50;
  margin-right: auto;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  position: absolute;
  right: -48px;
  bottom: 0;
  background-size: cover;
  background-position: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 输入区域样式 */
.input-container {
  position: fixed;
  bottom: 50px; /* 确保在底部导航栏上方 */
  left: 0;
  right: 0;
  padding: 12px 16px;
  background-color: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  z-index: 99;
}

.input-wrapper {
  flex: 1;
  background-color: #f3f4f6;
  border-radius: 24px;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  min-height: 44px; /* 设置最小高度 */
  max-height: 120px; /* 设置最大高度 */
  overflow-y: auto;
}

.message-input {
  --adm-color-primary: #7c4dff;
  --adm-font-size-main: 16px;
  background: transparent;
  border: none;
  padding: 8px 0;
  width: 100%;
  min-height: 24px;
  max-height: 100px;
  line-height: 1.5;
}

.message-input:disabled {
  opacity: 0.7;
}

.send-button {
  background: linear-gradient(135deg, #7c4dff 0%, #7e57ff 100%);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  height: 44px; /* 固定高度 */
  min-width: 80px; /* 最小宽度 */
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.send-button:not(:disabled):active {
  transform: scale(0.98);
}

/* AI思考中动画 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background-color: white;
  border-radius: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  animation: fadeIn 0.3s ease-out;
  margin-right: auto;
  margin-bottom: 16px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #7c4dff;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-4px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 适配安全区域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .input-container {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* 滚动条美化 */
.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
  background-color: rgba(124, 77, 255, 0.3);
  border-radius: 3px;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  .ai-container {
    background-color: #ffffff;
  }

  .chat-container {
    background-color: #f8f9fa;
  }

  .ai .message-content {
    background-color: white;
    color: #2c3e50;
  }

  .input-container {
    background-color: white;
    border-top-color: #e5e7eb;
  }

  .input-wrapper {
    background-color: #f3f4f6;
  }

  .message-input {
    color: #2c3e50;
  }
}

/* 消息内容样式优化 */
.message-content {
  position: relative;
  padding: 12px 16px;
  line-height: 1.5;
  font-size: 15px;
  word-break: break-word;
  border-radius: 16px;
  max-width: 80%;
}

/* 用户消息特殊样式 */
.user .message-content {
  background: linear-gradient(135deg, #7c4dff 0%, #7e57ff 100%);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  padding-right: 16px;
  box-shadow: 0 2px 4px rgba(124, 77, 255, 0.2);
}

/* AI消息特殊样式 */
.ai .message-content {
  background-color: white;
  color: #2c3e50;
  margin-right: auto;
  border-bottom-left-radius: 4px;
  padding-left: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 优化输入框容器 */
.input-container {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(229, 231, 235, 0.8);
}